package edu.zut;

import java.util.Scanner;

public class WhileDemo3 {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
        int m = input.nextInt();
        int n = input.nextInt();
//        保证m不比n小
        if (m<n)
        {
            int mid = m;
            m = n;
            n = mid;
        }
        int gcd = m % n;
        while (gcd!=0)
        {
            m =  n;
            n = gcd;
            gcd = m % n;
        }
        System.out.println("最大公约数是："+n);
    }
}
